var isSameTree = function(p, q) {
  const isSameRoot = (p,q) => {
    if(!p && !q) return true
    if(!p || !q) return false
    return p.val===q.val && isSameRoot(p.left,q.left) && isSameRoot(p.right,q.right)
  }
  return isSameRoot(p,q)
};